from devicetest.aw.OpenHarmony import CommonOH
from devicetest.core.test_case import TestCase, Step

from aw.common import common_setup, common_teardown
from aw.pom import DeskTop


# 依赖1300和1400
class PreTest_RK3568_Basic_Desktop_1500(TestCase, DeskTop):
    # 预置条件：
    # 烧写目标版本后，正常进入桌面，桌面有存在的图库、相机服务卡片
    # 测试步骤：
    # 1、长按图库服务卡片，点击移除
    # 2、长按相机服务卡片，点击移除
    # 预期结果：
    # 1、图库服务卡片从桌面移除
    # 2、相机服务卡片从桌面移除

    def __init__(self, controllers):
        self.TAG = self.__class__.__name__
        TestCase.__init__(self, self.TAG, controllers)

    def setup(self):
        common_setup(self.Phone1)

    def process(self):
        Step('步骤1、长按图库服务卡片，点击移除')
        CommonOH.touchByType(self.Phone1, 'FormComponent', mode='LONG')
        CommonOH.touchByText(self.Phone1, '移除')
        CommonOH.touchByText(self.Phone1, '移除')
        CommonOH.wait(self.Phone1, 1)
        Step('步骤2、长按相机服务卡片，点击移除')
        CommonOH.touchByType(self.Phone1, 'FormComponent', mode='LONG')
        CommonOH.touchByText(self.Phone1, '移除')
        CommonOH.touchByText(self.Phone1, '移除')
        Step('预期结果1&2、相机服务卡片从桌面移除')
        CommonOH.checkIfTypeExist(self.Phone1, 'FormComponent', expect=False)

    def teardown(self):
        common_teardown(self.Phone1)
